package com.allesblinkt.mucom.client;

import processing.core.PApplet;
import processing.core.PImage;

public class AnimatedSprite extends Sprite {

	private PImage secondImage;

	private int frameCount;

	public AnimatedSprite(PImage theImage, PImage theSecondImage) {
		super(theImage);

		secondImage = theSecondImage;
	}

	public void draw(PApplet p) {
		frameCount++;

		PImage theImage;
		if (frameCount % 30 > 15) {
			theImage = image;
		} else {
			theImage = secondImage;
		}

		p.image(theImage, -theImage.width / 2, -theImage.height);
	}

}
